package Demo1;

import javax.crypto.Mac;

class MyValue{
    public int val;
    public void func(){

    }
}
public class Test {
    public static void main(String[] args) {
        MyValue value1=new MyValue();
        value1.val=10;
        MyValue value2=new MyValue();
        value2.val=20;
        func(value1,value2);
        System.out.println(""+value1.val+""+value2.val);
    }
    static void func(MyValue val1,MyValue val2){
        MyValue tmp=new MyValue();
        tmp.val=val1.val;
        val1.val= val2.val;
        val2.val= tmp.val;
    }
}
